package edu.wfu.preparedDishes.commodity.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import edu.wfu.preparedDishes.commodity.entity.CommoditySpuEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import edu.wfu.preparedDishes.commodity.dao.CommoditySkuDao;
import edu.wfu.preparedDishes.commodity.entity.CommoditySkuEntity;
import edu.wfu.preparedDishes.commodity.service.CommoditySkuService;

import java.util.List;


@Service("commoditySkuService")
public class CommoditySkuServiceImpl extends ServiceImpl<CommoditySkuDao, CommoditySkuEntity> implements CommoditySkuService {

    @Autowired
    private CommoditySkuDao dao;

    @Override
    public List<CommoditySkuEntity> queryBySpuId(String spuId) {
        return dao.queryBySpuId(spuId);
    }

    @Override
    public CommoditySkuEntity getCommodityBySkuId(String skuId) {
        QueryWrapper<CommoditySkuEntity> wrapper = new QueryWrapper<CommoditySkuEntity>()
                .eq("sku_id",skuId);
        return dao.selectOne(wrapper);

    }
}